from typing import List
import bisect
import collections


class Solution:
    def kClosest(self, points: List[List[int]], K: int) -> List[List[int]]:
        return sorted(points, key=lambda x: x[0] * x[0] + x[1] * x[1])[:K]


if __name__ == "__main__":
    points = [[1, 3], [-2, 2]]
    K = 1
    res = Solution().kClosest(points, K)
    print(res)
